package game;

import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JPanel;

import controls.GameFlow;

public class Square extends JPanel{
	
	Color c;
	Unit u;
	Square north;
	Square east;
	Square south;
	Square west;
	int row;
	int column;
	
	
	
	public Square(int i, int j) {
		row=i;
		column=j;
		setSize(90,90);
		setToolTipText(i+","+j);
		setBackground(Color.black);

		addMouseListener(new MouseAdapter()
		{
			@Override
			public void mouseClicked(MouseEvent e)
			{
				if(!e.isMetaDown())
				{
					GameFlow.click(row,column);		
				}
				else
				{
					
				}
			}
		});	
	}
	public Color getC() {
		return c;
	}
	public void setC(Color c) {
		this.c = c;
		setBackground(c);
	}
	public Unit getU() {
		return u;
	}
	public void setU(Unit u) {		
		this.u = u;
		add(this.u);
	}
	public Square getNorth() {
		return north;
	}
	public void setNorth(Square north) {
		this.north = north;
	}
	public Square getEast() {
		return east;
	}
	public void setEast(Square east) {
		this.east = east;
	}
	public Square getSouth() {
		return south;
	}
	public void setSouth(Square south) {
		this.south = south;
	}
	public Square getWest() {
		return west;
	}
	public void setWest(Square west) {
		this.west = west;
	}
	public int getRow() {
		return row;
	}
	public void setRow(int row) {
		this.row = row;
	}
	public int getColumn() {
		return column;
	}
	public void setColumn(int column) {
		this.column = column;
	}

}
